<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link type="text/css" href="/static/default.min.css" rel="stylesheet">

		<link type="text/css" href="/static/box.css" rel="stylesheet">
			<title>{{.title}}</title> <script src="/static/jquery.min.js" type="text/javascript"></script><style type="text/css" adt="123"></style>
			<script src="/static/json.parse.js" type="text/javascript"></script>
			<script src="/static/jsformat.js" type="text/javascript"></script>

<style type="text/css">object,embed{                -webkit-animation-duration:.001s;-webkit-animation-name:playerInserted;                -ms-animation-duration:.001s;-ms-animation-name:playerInserted;                -o-animation-duration:.001s;-o-animation-name:playerInserted;                animation-duration:.001s;animation-name:playerInserted;}                @-webkit-keyframes playerInserted{from{opacity:0.99;}to{opacity:1;}}                @-ms-keyframes playerInserted{from{opacity:0.99;}to{opacity:1;}}                @-o-keyframes playerInserted{from{opacity:0.99;}to{opacity:1;}}                @keyframes playerInserted{from{opacity:0.99;}to{opacity:1;}}</style></head>

<body>

	<style>
.code {
	background: none repeat scroll 0 0 #fff;
	color: #359136;
	font-family: "Courier New", Courier, monospace;
	height: 300px;
	line-height: 20px;
	padding: 0 10px;
	width: 95%;
}

.helper {
	border: 1px solid #c6c6c6;
	color: #359136;
	font-family: "Courier New", Courier, monospace;
	margin-bottom: 15px;
	line-height: 20px;
	padding: 0 10px;
	width: 95%;
	line-height: 20px;
}

}
#subtopselect {
	display: none;
	position: absolute;
	background: #3e3e3e;
	padding: 0px 10px 0px 10px;
	margin-left: -10px;
	line-height: 25px;
	z-index: 9999999
}

#subtopselect a {
	display: block;
}

#subtopselect a:hover {
	
}
</style>

	<div style="line-height: 50px; height: 50px; font-size: 16px; width: 98%; margin: 0 auto; border-bottom: 2px solid #00b7ee; margin-bottom: 10px; background: url(http://www.juhe.cn/themes/images/data/i/7.png) left center no-repeat; text-indent: 30px">
		<span style="width: 340px; font-size: 25px; font-weight: bold;">{{.title}} </span><span style="color: #f32">V1.0beta</span>
	</div>
	<div class="juhe-box-main">
		<div class="juhe-box">
			<div class="juhe-box-left">
				<div class="juhe-box-tag"></div>

				<div class="data-request-type">
					请求方式：<input type="radio" name="type" value="get" checked="checked"><span class="cutime">GET</span>&nbsp;<input type="radio" name="type" value="post"><span class="cutime">POST</span>
				
				</div>
				<div class="data-request-dtype">
					返回格式：<input type="radio" name="dtype" value="json" checked="checked"><span class="cutime">JSON</span>&nbsp;
				
				</div>


				<div class="data-params">
					<b>接口地址:</b>
					<div>
						<input type="text" id="api-url" size="45" value="{{.myApi}}" name="api-url" style="background: #fcfcfc">
					
					</div>
					<b>API参数:</b>

					<div class="params-main">
						<form action="{{.myUrl}}" method="post">
							<div>
								<input type="text" size="8" class="key" value="email" name="input-param1" style="background: #fcfcfc">： <input id="_mobile" name="input-value1" type="text" size="20" value="18612693839">
							
							</div>
							<div>
								<input type="text" size="8" class="key" value="password" name="input-param2" style="background: #fcfcfc">： <input name="input-value2" type="text" size="20" value="123456">
							
							</div>
							<div>
								<input type="text" size="8" class="key" name="input-param3" style="background: #fcfcfc">： <input id="_mobile" name="input-value3" type="text" size="20" value="">
							
							</div>
							<div>
								<input type="text" size="8" class="key" name="input-param4" style="background: #fcfcfc">： <input name="input-value4" type="text" size="20" value="">
							
							</div>
							<div>
								<input type="text" size="8" class="key" name="input-param5" style="background: #fcfcfc">： <input id="_mobile" name="input-value5" type="text" size="20" value="">
							
							</div>
							<div>
								<input type="text" size="8" class="key" name="input-param6" style="background: #fcfcfc">： <input name="input-value6" type="text" size="20" value="">
							
							</div>
							<div>
								<input type="text" size="8" class="key" name="input-param7" style="background: #fcfcfc">： <input id="_mobile" name="input-value7" type="text" size="20" value="">
							
							</div>
							<div>
								<input type="text" size="8" class="key" name="input-param8" style="background: #fcfcfc">： <input name="input-value8" type="text" size="20" value="">
							
							</div>
							<div>
								<input type="text" size="8" class="key" name="input-param9" style="background: #fcfcfc">： <input id="_mobile" name="input-value9" type="text" size="20" value="">
							
							</div>
							<div>
								<input type="text" size="8" class="key" name="input-param10" style="background: #fcfcfc">： <input name="input-value10" type="text" size="20" value="">
							
							</div>




							<div class="box-btn">
								<input type="button" value="发送请求" class="btnbox" id="gobtn">
							
							</div>
						</form>
					</div>
				</div>


			</div>
			<div class="juhe-box-right">
				<div class="request-content">
					请求：
					<div class="show">
						<div class="show-request-type"></div>
						<div class="show-request-url"></div>
						<div class="show-request-params"></div>
					</div>
				</div>
				<div class="response-content">
					返回的内容： &nbsp;&nbsp;<a target="_blank" href="javascript:void(0)" id="code_show">常见错误代码及释义</a>
					<div class="helper" id="helper" style="display:none">
						<ul>
							<li>200 请求正常</li>
							<li>-1 表示数据错误</li>
							<li>1 数据正常</li>
						</ul>



					</div>

					<!--<div class="show" id="show-reponse-content">
	    			</div>-->
					<textarea class="show" id="show-reponse-content" readonly="readonly"></textarea>
				</div>
			</div>


			<div class="clearfix"></div>
		</div>
	</div>
	<!-------Footer-------->
	<div class="clearfix"></div>
	<div class="footer">
		<div class="fi">
			<span>版本:{{.version}}beta</span> | &nbsp;<a href="http://www.mingyisheng.com/">名医生</a>
		</div>
	</div>

	<script>
	function do_js_beautify2(datas) {
       js_source = datas.replace(/^\s+/, '');
       
        
        tabsize = 4;
        tabchar = ' ';
        if (tabsize == 1) {
            tabchar = '\t';
        }

        js_source = js_beautify( js_source, tabsize, tabchar);
        
       return  js_source;
    }
	function do_js_beautify() {
        js_source = $('#show-reponse-content').val().replace(/^\s+/, '');
       
        
        tabsize = 4;
        tabchar = ' ';
        if (tabsize == 1) {
            tabchar = '\t';
        }

        js_source = js_beautify(js_source, tabsize, tabchar);
        	$('#show-reponse-content').val(js_source);
       
         
        return false
    }
$(function(){
	$('#code_show').on('click',function(){
          $('#helper').toggle(300);
          return false;
		})
	//监听提交
	$('#gobtn').on('click',function(){
		var url = $.trim($('#api-url').val());
		var method = $('input[name="type"]:checked').val();
		var datas='"url":"'+url+'","method":'+'"'+method+'",';
		var  data1 ="";
		$('form input.key').each(function(k,v){
			   k =k+1;
              name =$(this).attr('name');
              value =$(this).val();
             // alert(value)
			
              if(value!=""&& value!=undefined){
                  v =$("input[name='input-value"+k+"']").val();
                  data1+='"'+value+'"'+":";
                  if($.isNumeric(v)){
                	  data1+=v+",";

                      }else{
                    	  data1+='"'+v+'",';
                      }
                  
                }
			})
			
			//
		if(data1!=""){
		
		datas+=data1;
		data1 = "{"+data1.substr(0,(data1.length-1))+"}";
		}
		datas = datas.substr(0,(datas.length-1));
		datas = "{" +datas +"}";
		d= JSON.parse(datas);
				
				var config = {
				        url:"{{.myUrl}}",
				        datatype:"json",
				        data:d,
				        type:"post",
				        success:function(d){
				        	$("#gobtn").val('发送请求');
				        	if($.isEmptyObject(d)){
				        		$('#show-reponse-content').val("数据返回空");
				        			return false;
				            	}
				        	
				        	//d = JSON.parse(d);
				        	//d = JSON.stringify(d);
				        	$('#show-reponse-content').val(d);
				        	do_js_beautify();
				            },
				        error:function(){
				        	
				        	$('#show-reponse-content').val("请求异常");
				            }




							}



				$('.show-request-params').html("参数列表：<br/><span class='code'>"+do_js_beautify2(JSON.stringify(data1))+"</span>");


					


		$('.show-request-type').html("请求类型："+method.toLocaleUpperCase());
		$('.show-request-url').html("接口地址："+url);
		
		$(this).val('正在请求');
		$.ajax(config);
		
	
	})
	
})





</script>




</body></html>